import type { BasePageReq } from '@wlydfe/service'
import type {
  CreditApplyPayModel,
  CreditDetailReq,
  CreditDetailRes,
  CreditlistModel,
  CreditModel,
  CreditPlanModel,
  CreditPlanRes,
  LimitModel,
  RepaymentModel,
} from './types'
import http from '@/service'
/**
 * 授信管理-授信审核列表
 *
 * @param data 搜索参数
 */
export const getAuditPage = (data: BasePageReq<Partial<CreditlistModel>>) => {
  return http.post({
    url: '/credit/limit/apply/queryPage',
    data,
  })
}

/**
 * 授信管理-额度管理列表
 *
 * @param data 搜索参数
 */
export const getLimitWlist = (data: BasePageReq<Partial<LimitModel>>) => {
  return http.post({
    url: '/credit/limit/queryPage',
    data,
  })
}

// 同步列表-额度管理
export const getRefresh = () => {
  return http.get({
    url: '/credit/limit/refresh',
  })
}

/**
 * 授信管理-额度管理列表
 *
 * @param id
 */
export const getLimitDetail = (id: string) => {
  return http.post({
    url: `/credit/limit/detail?id=${id}`,
  })
}

/**
 * 用信管理-用信申请列表
 * 用信管理-放款管理列表
 *
 * @param data 搜索参数
 */
export const getCreditList = (data: BasePageReq<Partial<CreditModel>>) => {
  return http.post({
    url: '/credit/apply/queryPage',
    data,
  })
}

/**
 * 用信管理-获取用信申请详情
 * 用信管理-融资信息
 *
 * @param data 搜索参数
 */
export const getCreditProgress = (data: CreditDetailRes<Partial<CreditDetailReq>>) => {
  return http.post({
    url: '/credit/apply/queryProgress',
    data,
  })
}

/**
 * 用信管理-用信申请详情-运单明细列表
 *
 * @param data 搜索参数
 */
export const getCreditProgressList = (data: BasePageReq<Partial<CreditApplyPayModel>>) => {
  return http.post({
    url: '/credit/payment/list',
    data,
  })
}

/**
 * 用信管理-放款管理详情
 *
 * @param bizSn
 */
export const getApplyDetail = (bizSn: string) => {
  return http.post({
    url: `/credit/apply/detail?bizSn=${bizSn}`,
  })
}

/**
 * 获取用信管理还款计划
 *
 * @param data 搜索参数
 */
export const getCreditDetailPlan = (data: CreditPlanRes<Partial<CreditPlanModel>>) => {
  return http.post({
    url: '/credit/apply/queryPage',
    data,
  })
}

/**
 * 用信管理-用信申请列表
 *
 * @param data 搜索参数
 */
export const getRepaymentList = (data: BasePageReq<Partial<RepaymentModel>>) => {
  return http.post({
    url: '/credit/repayment/detail/list',
    data,
  })
}
